<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="view/css/import.css"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
<title>汎用CSV一括登録</title>
</head>

<body id="layres">
<div class="layreshdr">
	<h3>一括登録</h3>

	<div id="topMessage">${MESSAGE}</div>
</div>
<div class="layresmaj">
	<div class="layrespri">
		<div>
			<form id="batch" method="post" action="${ACTION_PATH}">
				<input type="hidden" name="AID" id="aid"/>
				<input type="hidden" name="Id" id="id"/>
			</form>
			<table class="fixborder">
				<thead>
					<tr>
						<th>登録名称</th>
						<th colspan="2"></th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${band.IdBatchPattern}" var="bind">
					<tr>
						<td>
							<a href="${ACTION_PATH}?Id=${bind.IdBatchPattern}" >${bind.NmBatchPattern}</a>
						</td>
						<td>
							<button type="button" class="delete" name="${bind.IdBatchPattern}">削除</button>
						</td>
						<td>
							<button type="button" class="output" name="${bind.IdBatchPattern}">出力</button>
						</td>
					</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<div>
			<a class="outputMake" href="javascript:void(0);">一括出力作成</a>

			<div id="outputMakeTbl" style="display:none">
			<div>
			<form id="form" method="post">
			<input type="hidden" name="AID" value="register"/>
			<input type="hidden" name="Version" value="${empty Version ? '1' : Version}"/>
			<input type="hidden" name="RepeatId" value="${RepeatId}"/>
			<table class="fixborder dnd">
				<thead>
					<tr class="nodrag nodrop">
						<th>選択</th>
						<th>パターン名</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${band.MyPatternValue}" var="bind">
					<tr>
						<td align="center">
						<utl:check var="chk" name="SelectId" value="${bind.MyPatternValue}"/>
						<input type="checkbox" class="nodrag" name="SelectId" value="${chk}"/>
						</td>
						<td>
						${bind.MyPatternLabel}
						</td>
					</tr>
					</c:forEach>
				</tbody>
			</table>

			<div>
				<select name="Interval" class="interval">
					<option value=""></option>
					<utl:select var="sel" name="Interval" value="next"/>
					<option value="${sel}">次回</option>
					<utl:select var="sel" name="Interval" value="day"/>
					<option value="${sel}">毎日</option>
					<utl:select var="sel" name="Interval" value="week"/>
					<option value="${sel}">毎週</option>
					<utl:select var="sel" name="Interval" value="month"/>
					<option value="${sel}">毎月</option>
					<utl:select var="sel" name="Interval" value="year"/>
					<option value="${sel}">毎年</option>
				</select>
				<span class="hm" style="${empty Interval ? 'display:none;' : ''}">
				<select name="Hour">
					<c:forEach begin="0" end="23" varStatus="i">
					<c:set var="num" value="${view:numfmt(i.index, '00')}"/>
					<utl:select var="sel" name="Hour" value="${num}"/>
					<option value="${sel}">${num}</option>
					</c:forEach>
				</select>
				<label>時</label>
				<select name="Minute">
					<c:forEach begin="0" end="5" varStatus="i">
					<c:set var="num" value="${view:numfmt(i.index * 10, '00')}"/>
					<utl:select var="sel" name="Minute" value="${num}"/>
					<option value="${sel}">${num}</option>
					</c:forEach>
				</select>
				<label>分</label>
				</span>
				<span class="week" style="${Interval eq 'week' ? '' : 'display:none;'}">
				<select name="Week">
					<option value=""></option>
					<utl:select var="sel" name="Week" value="2"/>
					<option value="${sel}">月</option>
					<utl:select var="sel" name="Week" value="3"/>
					<option value="${sel}">火</option>
					<utl:select var="sel" name="Week" value="4"/>
					<option value="${sel}">水</option>
					<utl:select var="sel" name="Week" value="5"/>
					<option value="${sel}">木</option>
					<utl:select var="sel" name="Week" value="6"/>
					<option value="${sel}">金</option>
					<utl:select var="sel" name="Week" value="7"/>
					<option value="${sel}">土</option>
					<utl:select var="sel" name="Week" value="1"/>
					<option value="${sel}">日</option>
				</select>
				<label>曜日</label>
				</span>
				<span class="ymd" style="${not empty Interval and Interval ne 'week' and Interval ne 'day' ? '' : 'display:none;'}">
				<input type="text" name="YearMonthDay" value="${YearMonthDay}" class="year_month_day" maxlength="8" size="10"/>
				<label class="ymd_label">${Interval eq 'next' ? '年月日' : (Interval eq 'year' ? '月日' : '日')}</label>
				</span>
			</div>
			<div>
			<label id="batchNameLabel">登録名称</label>
			<input type="text" name="BatchName" id="batchName" value="${BatchName}" maxlength="128" size="64" />
			</div>
			</form>
			</div>

			<!-- 操作エリア -->
			<div>
				<button type="button" class="register">登録</button>
			</div>
			</div>
		</div>
	</div>
	<div class="layressec">
	</div>
	<div class="layrester">
	</div>
</div>
<div class="layresftr">
	<div class="layresftr1">
	</div>
	<div class="layresftr2">
	</div>
</div>

<script src="view/js/jquery.min.js"></script>
<script src="view/js/jquery.tablednd.js"></script>
<script src="view/js/submit.js"></script>
<script>
//<![CDATA[
$(document).ready(function() {
	$('button.delete').click(function(){
		if (window.confirm('削除します。よろしいですか？')) {
			$('#aid').val('delete');
			$('#id').val($(this).attr('name'));
			$('#batch').submit();
		}
	});
	$('button.output').click(function(){
		if (window.confirm('出力します。よろしいですか？')) {
			$('#aid').val('output');
			$('#id').val($(this).attr('name'));
			$('#batch').submit();
		}
	});
	$('button.register').click(function(){
		if (window.confirm('登録します。よろしいですか？')) {
			$('#form').submit();
		}
	});
	$('a.outputMake').click(function(){$('#outputMakeTbl').toggle(100);});
	$('table.dnd').tableDnD();
	if (location.search !== '') {
		$('#outputMakeTbl').show();
	}

	$('select.interval').change(function(){
		if ('week' === $(this).val()) {
			$('span.hm').show();
			$('span.week').show();
			$('span.ymd').hide();
		} else if ('' === $(this).val()) {
			$('span.hm').hide();
			$('span.week').hide();
			$('span.ymd').hide();
		} else if ('day' === $(this).val()) {
			$('span.hm').show();
			$('span.week').hide();
			$('span.ymd').hide();
		} else {
			$('span.hm').show();
			$('span.week').hide();
			$('span.ymd').show();
			$('input.year_month_day').val('');
			if ('next' === $(this).val()) {
				$('label.ymd_label').text('年月日');
			} else if ('year' === $(this).val()) {
				$('label.ymd_label').text('月日');
			} else if ('month' === $(this).val()) {
				$('label.ymd_label').text('日');
			}
		}
	});
});
//]]>
</script>
</body>
</html>
